package com.si.anddos.library.provider;

import com.si.anddos.DownloadProviderService;
import com.si.anddos.UploadProviderService;

import android.os.Looper;

/**
 * Maybe this class can be used as messaging display
 * 
 * @author Carlos Martinez
 *
 */
public class ProviderMessage implements Runnable {
	
	private String message;
	
	private String file;
	
	private DownloadProviderService mp;
	
	private UploadProviderService ups;
	
	private Thread messaging;
	
	public ProviderMessage(String message, DownloadProviderService service) {
		this.message = message;
		this.mp = service;
	}
	
	public ProviderMessage(String message, UploadProviderService service) {
		this.message = message;
		this.ups = service;
	}
	
	public void setFile(String fileName) {
		this.file = fileName;
	}
	
	public String getFile() {
		return this.file;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}
	
	public String getMessage() {
		return this.message;
	}
	
	public void showMessage() {
		this.messaging = new Thread(this);
		this.messaging.start();
	}

	public void run() {
		Looper.prepare();
		if (this.mp != null) {
			this.mp.displayInformation(this.message);
		} else {
			this.ups.displayInformation(this.message);
		}
		Looper.loop();
	}

}
